const { injectComponents } = require("./renderComs")

module.exports = function (source) {
  const { resourcePath } = this
  // 只匹配pages和下pagesSub二级目录的.vue文件
  const rex = /(pages|pagesSub)[\\/][^\\/]+[\\/][^\\/]+\.vue$/;
  if (rex.test(resourcePath)) {
    source = injectComponents(source, resourcePath)
  }
  return source
}